 function(parse_ref rstring)
    address_get(${rstring})
    ans(str)
    string_take_regex(str ":[a-zA-Z0-9_-]+")
    ans(match)
    if(NOT DEFINED match)
      return()
    endif()
  #  message("match ${match}")
    is_address("${match}")
    ans(isvalid)

    if(NOT  isvalid)
      return()
    endif()



    map_tryget(${definition} matches)
    ans(matches)
    #json_print(${matches})
    is_map(${matches})
    ans(ismap)

    if(NOT ismap)
      address_get(${match})
      ans(ref_value)

      if("${matches}" MATCHES "${ref_value}")
        return_ref(match)
      endif()
      return()
    else()
      map_keys(${matches})
      ans(keys)
      foreach(key ${keys})
        map_tryget(${match} "${key}")
        ans(val)

        map_tryget(${matches} "${key}")
        ans(regex)

        if(NOT "${val}" MATCHES "${regex}")
          return()
        endif()
      endforeach()
    endif()
    address_set(${rstring} "${str}")
    return_ref(match)
  endfunction()